import { useLocation, useNavigate } from 'react-router-dom';

const Login = () => {
    const location = useLocation();
    const navigate = useNavigate();
    return (
        <div>
            <h1>登录</h1>
            <button onClick={() => {
                localStorage.setItem('token', '123456');
                navigate(location.state?.from?.pathname || '/main');
            }}>登录</button>
    </div>
    )
}

export default Login;